<template lang="jade">
h-loader-full(url='loader')
  .box
    m-title(icon='add',name='添加公司')
    table.single
      mf-row(name='用户名：'): input(type='text',v-model='list.username')

      mf-row(name='密码：'): input(type='text',v-model='list.password')


      mf-row(name='公司名称：'): input(type='text',v-model='list.cname')
      mf-row(name='公司地址：'): input(type='text',v-model='list.address')
      mf-row(name='公司邮箱：'): input(type='text',v-model='list.email')
      mf-row(name='联系人姓名：'): input(type='text',v-model='list.contact_name')
      mf-row(name='联系人电话：'): input(type='text',v-model='list.contact_mobile')
      mf-row(name='公司法人：'): input(type='text',v-model='list.legalPerson')
      mf-row(name='公司简介：'): textarea(style='width:500px; height:200px;',v-model='list.intro')
      mf-row(name='营业执照：'): mf-upload(uploadid='img', amount='1', project='xiongan', category='license', rule='company', @upload_data='text', :data='list.license')
      mf-row(name='公司LOGO：'): mf-upload(uploadid='img1', amount='1', project='xiongan', category='logo', rule='company', @upload_data='text1', :data='list.logo')
      mf-row(name='')
        button(@click='add') 添加
</template>
----------------------------------------------------------------------------------------
<script>
import { MessageBox } from 'mint-ui'
export default {
	data () {
		return {
      loader:{ 
        scope:'company/scope'
         },
      scope:[],
      list:{
        username : '',
        password : '',
        cname : '',
        nature:1,
        trade:1,
        address : '',
        email : '',
        contact_name : '',
        contact_mobile : '',
        legalPerson : '',
        status:1,
        intro : '',
        license:[],
        logo:[],

      }
	 }
  },
  mounted () {
    
  },
	methods: {
      text(data){
        this.list.license = data
      },
      text1(data){
        this.list.logo = data
      },
      add(){

        for(var key in this.list){
          if(this.list[key] == '' || this.list[key].length == 0){
            this.$msg.error('需要添加所有信息');
            return false;
          }
        }

        this.$ajax.put('company/add',this.list,(res)=>{
          this.$msg.success('添加成功');
          setTimeout(function(){
            window.location.href = '/xiongan/examine/company_list.html';
          }, 1000);
        },(res)=>{
          this.$msg.error('添加失败')
        })
      },
	  }
  }
</script>
----------------------------------------------------------------------------------------
<style lang="less" scoped>
@import "../../../plugin/style/mixin";

</style>